package continueBreakTest;

public class ContinueBreakTest {

	
	/**
	 * continue只是跳过本次接下来的步骤，但是不会跳过循环
	 */
	public static void continue1()
	{
		for(int i=0;i<10;i++)
		{
			if(i%2==0)
				continue;
			System.out.println("continue1   i="+i);
		}
	}
	
	/**
	 * break跳出整个循环
	 */
	public static void break1()
	{
		for(int i=0;i<10;i++)
		{
			if(i==5)
				break;
			System.out.println("break1   i="+i);
		}
	}
	
	/**
	 * 对于多重循环，怎么跳转到更外层循环
	 */
	public static void breakAtPoint()
	{
		over:
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				System.out.println("breakAtPoint i="+i+"   j="+j);
				if(i+j==3)
					break over;
			}
		}
	}
	
	public static void main(String[] args) {
		continue1();
		
		break1();
		
		breakAtPoint();
	}
}
